import request from '../utils/request'

/**
 * 根据条件分页查询
 * @param current
 * @param size
 * @param roleName
 * @returns {AxiosPromise}
 */
export const findAll = (current,size,roleName) =>{
  return request({
    url: '/system/role/findAll',
    method: 'get',
    params: {
      current,
      size,
      roleName
    }
  })
}

/**
 * 逻辑删除 修改状态
 * @param id
 * @returns {AxiosPromise}
 */
export const delRole = (id) => {
  return request({
    url: '/system/role/delRole',
    method: 'delete',
    params: {
      id
    }
  })
}

/**
 * 根据id进行查询
 * @param id
 */
export const findById=(id) =>{
  return request({
    url: '/system/role/findById',
    method: 'get',
    params: {
      id
    }
  })
}

/**
 * 修改角色信息
 * @param role
 * @returns {AxiosPromise}
 */
export const updateRole = (role) =>{
  return request({
    url: '/system/role/updateRole',
    method: 'post',
    data:role
  })
}

/**
 * 添加方法
 * @param role
 * @returns {AxiosPromise}
 */
export const addRole = (role) => {
  return request({
    url: '/system/role/addRole',
    method: 'post',
    data:role
  })
}

/**
 * 导出角色信息
 * @param roleName
 * @returns {AxiosPromise}
 */
export const exportRoleExcel=(roleName)=>{
  return request({
    url: '/system/role/export',
  method: 'post',
    params:{
      roleName
    },
    responseType:"blob"
  })
}
